using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class Exchange_orderMap : EntityTypeConfiguration<Exchange_order>
    {
        public Exchange_orderMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ID, t.Number, t.vendid, t.Date });

            // Properties
            this.Property(t => t.ID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);

            this.Property(t => t.Number)
                .IsRequired()
                .HasMaxLength(8);

            this.Property(t => t.vendid)
                .IsRequired()
                .HasMaxLength(6);

            this.Property(t => t.Remark1)
                .HasMaxLength(100);

            this.Property(t => t.Remark2)
                .HasMaxLength(100);

            this.Property(t => t.Routing)
                .HasMaxLength(100);

            // Table & Column Mappings
            this.ToTable("Exchange_order");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.Number).HasColumnName("Number");
            this.Property(t => t.vendid).HasColumnName("vendid");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Remark1).HasColumnName("Remark1");
            this.Property(t => t.Remark2).HasColumnName("Remark2");
            this.Property(t => t.Routing).HasColumnName("Routing");
            this.Property(t => t.Tax).HasColumnName("Tax");
            this.Property(t => t.Cash_collection).HasColumnName("Cash_collection");
            this.Property(t => t.Total).HasColumnName("Total");
            this.Property(t => t.generated).HasColumnName("generated");
        }
    }
}
